home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / timer.inc < prev    next >
Encoding:
Text File  |  1997-01-16  |  6.9 KB  |  239 lines

  1. ;*    TIMER.INC
  2. ;*
  3. ;* TempoTimer
  4. ;*
  5. ;* $Id: timer.inc,v 1.3 1997/01/16 18:41:59 pekangas Exp $
  6. ;*
  7. ;* Copyright 1996,1997 Housemarque Inc.
  8. ;*
  9. ;* This file is part of the MIDAS Sound System, and may only be
  10. ;* used, modified and distributed under the terms of the MIDAS
  11. ;* Sound System license, LICENSE.TXT. By continuing to use,
  12. ;* modify or distribute this file you indicate that you have
  13. ;* read the license and understand and accept it fully.
  14. ;*
  15.  
  16.  
  17. GLOBAL  LANG tmrActive : _int
  18.  
  19.  
  20. ;/***************************************************************************\
  21. ;*
  22. ;* Function:     int tmrGetScrSync(unsigned *scrSync);
  23. ;*
  24. ;* Description:  Calculates the screen synchronization value for timer
  25. ;*
  26. ;* Input:        unsigned *scrSync       pointer to screen synchronization
  27. ;*                                       value
  28. ;*
  29. ;* Returns:      MIDAS error code.
  30. ;*               Screen syncronization value used with tmrSyncScr() is stored
  31. ;*               in *scrSync.
  32. ;*
  33. ;\***************************************************************************/
  34.  
  35. GLOBAL  LANG tmrGetScrSync : _funct
  36.  
  37.  
  38.  
  39.  
  40. ;/***************************************************************************\
  41. ;*
  42. ;* Function:     int tmrInit(void);
  43. ;*
  44. ;* Description:  Initializes TempoTimer.
  45. ;*
  46. ;* Returns:      MIDAS error code
  47. ;*
  48. ;\***************************************************************************/
  49.  
  50. GLOBAL  LANG tmrInit : _funct
  51.  
  52.  
  53.  
  54.  
  55. ;/***************************************************************************\
  56. ;*
  57. ;* Function:     int tmrClose(void);
  58. ;*
  59. ;* Description:  Uninitializes TempoTimer. MUST be called if and ONLY if
  60. ;*               tmrInit() has been called.
  61. ;*
  62. ;* Returns:      MIDAS error code
  63. ;*
  64. ;\***************************************************************************/
  65.  
  66. GLOBAL  LANG tmrClose : _funct
  67.  
  68.  
  69.  
  70.  
  71. ;/***************************************************************************\
  72. ;*
  73. ;* Function:    int tmrPlaySD(SoundDevice *SD);
  74. ;*
  75. ;* Description: Starts playing sound with a Sound Device ie. calling its
  76. ;*              Play() function in the update rate, which is set to
  77. ;*              50Hz.
  78. ;*
  79. ;* Input:       SoundDevice *SD         Sound Device that will be used
  80. ;*
  81. ;* Returns:     MIDAS error code.
  82. ;*
  83. ;\***************************************************************************/
  84.  
  85. GLOBAL  LANG tmrPlaySD : _funct
  86.  
  87.  
  88.  
  89.  
  90. ;/***************************************************************************\
  91. ;*
  92. ;* Function:    int tmrStopSD(void);
  93. ;*
  94. ;* Description: Stops playing sound with the Sound Device.
  95. ;*
  96. ;* Returns:     MIDAS error code.
  97. ;*
  98. ;\***************************************************************************/
  99.  
  100. GLOBAL  LANG tmrStopSD : _funct
  101.  
  102.  
  103.  
  104.  
  105. ;/***************************************************************************\
  106. ;*
  107. ;* Function:    int tmrPlayMusic(void (*play)(), int *playerNum);
  108. ;*
  109. ;* Description: Starts playing music with the timer.
  110. ;*
  111. ;* Input:       void (*play)()          Music playing function
  112. ;*              int *playerNum          Pointer to player number, used
  113. ;*                                      for stopping music
  114. ;*
  115. ;* Returns:     MIDAS error code. Player number is written to *playerNum.
  116. ;*
  117. ;* Notes:       There can be a maximum of 16 music players active at the
  118. ;*              same time.
  119. ;*
  120. ;\****************************************************************************/
  121.  
  122. GLOBAL  LANG tmrPlayMusic : _funct
  123.  
  124.  
  125.  
  126.  
  127. ;/***************************************************************************\
  128. ;*
  129. ;* Function:    int tmrStopMusic(int playerNum);
  130. ;*
  131. ;* Description: Stops playing music with the timer.
  132. ;*
  133. ;* Input:       int playerNum           Number of player to be stopped.
  134. ;*
  135. ;* Returns:     MIDAS error code
  136. ;*
  137. ;\***************************************************************************/
  138.  
  139. GLOBAL  LANG tmrStopMusic : _funct
  140.  
  141.  
  142.  
  143.  
  144. ;/***************************************************************************\
  145. ;*
  146. ;* Function:    int tmrSyncScr(unsigned sync, void (*preVR)(),
  147. ;*                  void (*immVR)(), void (*inVR)());
  148. ;*
  149. ;* Description: Synchronizes the timer to screen refresh.
  150. ;*
  151. ;* Input:       unsigned sync           Screen synchronization value returned
  152. ;*                                      by tmrGetScrSync().
  153. ;*              void (*preVR)()         Pointer to the routine that will be
  154. ;*                                      called BEFORE Vertical Retrace
  155. ;*              void (*immVR)()         Pointer to the routine that will be
  156. ;*                                      called immediately after Vertical
  157. ;*                                      Retrace starts
  158. ;*              void (*inVR)()          Pointer to the routine that will be
  159. ;*                                      called some time during Vertical
  160. ;*                                      Retrace
  161. ;*
  162. ;* Returns:     MIDAS error code
  163. ;*
  164. ;* Notes:       preVR() and immVR() functions must be as short as possible
  165. ;*              and do nothing else than update counters or set some VGA
  166. ;*              registers to avoid timer synchronization problems. inVR()
  167. ;*              can take a longer time and can be used for, for example,
  168. ;*              setting the palette.
  169. ;*
  170. ;*              Remember to use the correct calling convention for the xxVR()
  171. ;*              routines! (pascal for Pascal programs, cdecl otherwise).
  172. ;*
  173. ;\***************************************************************************/
  174.  
  175. GLOBAL  LANG tmrSyncScr : _funct
  176.  
  177.  
  178.  
  179.  
  180. ;/***************************************************************************\
  181. ;*
  182. ;* Function:     int tmrStopScrSync(void);
  183. ;*
  184. ;* Description:  Stops synchronizing the timer to the screen.
  185. ;*
  186. ;* Returns:      MIDAS error code
  187. ;*
  188. ;\***************************************************************************/
  189.  
  190. GLOBAL  LANG tmrStopScrSync : _funct
  191.  
  192.  
  193.  
  194. ;/***************************************************************************\
  195. ;*
  196. ;* Function:     int tmrSetUpdRate(unsigned updRate);
  197. ;*
  198. ;* Description:  Sets the timer update rate, ie. the rate at which the music
  199. ;*               playing routine is called
  200. ;*
  201. ;* Input:        unsigned updRate       updating rate, in 100*Hz (5000=50Hz)
  202. ;*
  203. ;* Returns:      MIDAS error code
  204. ;*
  205. ;\***************************************************************************/
  206.  
  207. GLOBAL  LANG tmrSetUpdRate : _funct
  208.  
  209.  
  210.  
  211. ;/***************************************************************************\
  212. ;*       enum tmrFunctIDs
  213. ;*       ----------------
  214. ;* Description:  ID numbers for TempoTimer functions
  215. ;\***************************************************************************/
  216.  
  217. ENUM    tmrFunctIDs \
  218.         ID_tmrGetScrSync = ID_tmr, \
  219.         ID_tmrInit, \
  220.         ID_tmrClose, \
  221.         ID_tmrPlaySD, \
  222.         ID_tmrStopSD, \
  223.         ID_tmrPlayMusic, \
  224.         ID_tmrStopMusic, \
  225.         ID_tmrSyncScr, \
  226.         ID_tmrStopScrSync, \
  227.         ID_tmrSetUpdRate
  228.  
  229.  
  230. ;* $Log: timer.inc,v $
  231. ;* Revision 1.3  1997/01/16 18:41:59  pekangas
  232. ;* Changed copyright messages to Housemarque
  233. ;*
  234. ;* Revision 1.2  1996/05/30 22:38:46  pekangas
  235. ;* no changes?
  236. ;*
  237. ;* Revision 1.1  1996/05/22 20:49:33  pekangas
  238. ;* Initial revision
  239. ;*